const express = require("express");

const indexRouter = require("./routes/index.js");
const cakeRouter = require("./routes/cake.js");
const userRouter = require("./routes/user.js");
const shopcartRouter = require("./routes/shopcart.js");
const app = express();


app.use(
  express.urlencoded({
    extended: false,
  })
);

const cors = require("cors");

app.use(
  cors({
    origin: ["http://127.0.0.1:8080"],
  })
);
// 使用主页路由
app.use("/index", indexRouter);
app.use("/cake", cakeRouter);
app.use("/user", userRouter);
app.use("/shopcart", shopcartRouter);


app.listen(3000, () => {
  console.log("服务器启动成功");
});
